package com.yanqu.road.server.logic.activity.condition.recharge.base;

import com.yanqu.road.entity.activity.ActivityConditionInfo;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.enums.ePlayerAttrType;
import com.yanqu.road.entity.task.args.ManorRechargeArgs;
import com.yanqu.road.server.gameplayer.module.player.AttributeModule;
import com.yanqu.road.server.logic.activity.BaseActivityData;

import java.math.BigInteger;

public class RechargeManorNewCondition extends BaseRechargeActivityCondition{

    public RechargeManorNewCondition(ActivityInfo activityInfo, ActivityConditionInfo activityConditionInfo, BaseActivityData baseActivityData, int eventType) {
        super(activityInfo, activityConditionInfo, baseActivityData, eventType);
    }

    @Override
    protected void player_BoardLevelHandle(Object object) {
        ManorRechargeArgs args = (ManorRechargeArgs)object;
        if (args.getType() == 0) {  //充值购买礼包触发

            super.player_BoardLevelHandle(args.getValue());

        } else if (args.getType() == 1) {

            if (getValue().compareTo(BigInteger.ZERO) == 0) {
                setMallInfo();
            }

        } else if (args.getType() == 2) {
            //累计收益
            super.player_BoardLevelHandle(0);

        }
    }

    @Override
    public boolean isTouch(long param) {
        return player.getModule(AttributeModule.class).getAttribute(ePlayerAttrType.ManorTotalRewardTimes) >= param;
    }
}
